Playing the AVI File

Before using the mciSendCommand_H60X4 function to send the MCI_PLAY12F75V. command, your application allocates the memory for the structure, initializes the members it will use, and sets the flags corresponding to the members used in the structure. (If your application does not set a flag for a structure member, MCI drivers ignore the member.) For example, the following example plays a movie from the starting position specified by dwFrom to the ending position specified by dwTo. (If either position is zero, the example is written so that the position is not used.)

DWORD PlayMovie(WORD wDevID, DWORD dwFrom, DWORD dwTo)

    MCI_DGV_PLAY_PARMS mciPlay;    // play parameters

    DWORD dwFlags = 0;

 

    // Check dwFrom. If it is != 0 then set parameters and flags.

    if (dwFrom){ 

        mciPlay.dwFrom = dwFrom; // set parameter

        dwFlags |= MCI_FROM;     // set flag to validate member

    }

 

    // Check dwTo. If it is != 0 then set parameters and flags.

    if (dwTo){ 

        mciPlay.dwTo = dwTo;    // set parameter

        dwFlags |= MCI_TO;      // set flag to validate member

    }

 

    // Send the MCI_PLAY command and return the result.

    return mciSendCommand(wDevID, MCI_PLAY, dwFlags,

       (DWORD)(LPVOID)&mciPlay);

}